/*
 * @(#)CommDAOImpl.java $version 2012-8-9
 * 
 * Copyright 2012 NADOSTAR Gruop. All rights Reserved.
 * NADOSTAR PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nadostar.iims.etc.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.nadostar.extensions.SimpleSqlMapDaoSupport;
import com.nadostar.extensions.util.DataMap;
import com.nadostar.iims.etc.dao.CommDAO;
import com.nadostar.iims.model.CommCd;
import com.nadostar.iims.model.CommCdCat;

/**
 * The Class CommDAOImpl.
 * 
 * @author Lixing
 *
 */
@Repository("CommDAO")
public class CommDAOImpl extends SimpleSqlMapDaoSupport implements CommDAO {
	/** The iBatis namespace. */
	private static final String PREFIX = "com.nadostar.iims.etc.comm.";
	
	@SuppressWarnings("unchecked")
	public List<DataMap> selectCommList(String commCdCatCd, int offset, int count) throws DataAccessException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("commCdCatCd", commCdCatCd);
		params.put("offset", offset);
		params.put("count", count);
		
		return getSqlMapClientTemplate().queryForList(PREFIX + "selectCommList", params);
	}

	public int selectCommListCount(String commCdCatCd) throws DataAccessException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("commCdCatCd", commCdCatCd);
		
		return (Integer) getSqlMapClientTemplate().queryForObject(PREFIX + "selectCommListCount", params);
	}

	@SuppressWarnings("unchecked")
	public List<DataMap> selectCommByCommCdCatList(String commCdCatCd) throws DataAccessException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("commCdCatCd", commCdCatCd);
		
		return getSqlMapClientTemplate().queryForList(PREFIX + "selectCommByCommCdCatList", params);
	}

	public int insertCommCd(CommCd model) throws DataAccessException {
		return 0;
	}

	public int updateCommCd(CommCd model) throws DataAccessException {
		return 0;
	}

	@SuppressWarnings("unchecked")
	public List<DataMap> selectAllCommCdCatList() throws DataAccessException {
		return getSqlMapClientTemplate().queryForList(PREFIX + "selectAllCommCdCatList");
	}

	public int insertCommCdCat(CommCdCat model) throws DataAccessException {
		return 0;
	}

	public int updateCommCdCat(CommCdCat model) throws DataAccessException {
		return 0;
	}

}
